package com.boc.langxiang.util;

import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

/**
 * CreateTime: 2016-07-06下午1:47
 * Author: wjkjinke00@126.com
 * Description:
 */
public class RecyclerViewUtil {

    private RecyclerViewUtil() {
    }

    public static int getScollYDistance(RecyclerView recylerview) {
        LinearLayoutManager layoutManager = (LinearLayoutManager) recylerview.getLayoutManager();
        int position = layoutManager.findFirstVisibleItemPosition();
        View firstVisiableChildView = layoutManager.findViewByPosition(position);
        int itemHeight = firstVisiableChildView.getHeight();
        return (position) * itemHeight - firstVisiableChildView.getTop();
    }
}
